<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no,minimal-ui" />
        <style>
            html,body,div,span{padding:0;border:0;margin:0;outline:0;box-sizing:border-box;}
            body{overflow:hidden;padding:5px;}
        </style>
    </head>
    <body id="body">
        <script>
            document.addEventListener('DOMContentLoaded',function(){
                var a = (function(){
                    var img = document.createElement('img');
                    document.body.appendChild(img);
                    return {
                        setSrc:function(src){
                            img.src = src;
                        }
                    }
                })();
                a.setSrc('1.jpg');
                console.dir(a);
            });
        </script>
    </body>
</html>